package com.iot.ic.common;

/**
 * @Description:返回值及返回描述
 * @author xiuge
 * @date 2016年7月11日上午9:27:33
 */
public enum ReturnCode {
	No_Err(1,"请求成功","success"),
	No_LoginOK(1,"登录成功","success"),
	No_UpdateRefereeOK(1,"修改裁判信息成功","success"),
	No_DeleteRefereeOK(1,"删除裁判信息成功","success"),
	No_AddStadiumResultOK(1,"新增比赛成绩信息成功","success"),
	No_RegisterOK(1,"用户添加成功","success"),
	No_PostScenesResultOK(1,"提交场景成绩成功","success"),
	No_EndMatchOK(1,"结束比赛成功","success"),
	No_StartManualInterventionOK(1,"开始人工干预成功","success"),
	No_EndManualInterventionOK(1,"结束人工干预成功","success"),
	No_UpdateDeviceOK(1,"修改设备信息成功","success"),
	No_AddScenesOK(1,"添加场景信息成功","success"),
	No_AddDeviceOK(1,"添加设备成功","success"),
	No_DeleteDeviceOK(1,"删除设备成功","success"),
	No_UpdateScenesOK(1,"更新场景信息成功","success"),
	No_AddRefereeOK(1,"添加裁判信息成功","success"),
	No_AddFaultSupportOK(1,"添加故障支援信息成功","success"),
	No_DeleteScenesOK(1,"删除场景信息成功","success"),
	No_AddIllegalOK(1,"添加违规行为成功","success"),
	No_UpdateIllegalOK(1,"更新违规行为成功","success"),
	No_DeleteIllegalOK(1,"删除违规行为成功","success"),
	No_AddEquipmentOK(1,"添加设备成功","success"),
	No_UpdateEquipmentOK(1,"更新设备成功","success"),
	No_DeleteEquipmentOK(1,"删除设备成功","success"),
	No_AddStadiumOK(1,"增加赛道成功","success"),
	No_UpdateStadiumOK(1,"修改赛道成功","success"),
	No_DeleteStadiumOK(1,"删除赛道信息成功","success"),
	No_DeleteDriver(1,"删除司机信息成功","success"),
	No_AddTeamOK(1,"添加车队信息成功","success"),
	No_UpdateTeamOK(1,"更新车队信息成功","success"),
	No_DeleteManualInterventionOK(1,"删除人工干预信息成功","success"),
	No_UpdateOKStadiumResultOK(1,"修改比赛成绩成功","success"),
	Err_RequestFailed(-1,"请求失败","error"),
	No_DeleteTeamOK(1,"删除车队信息成功","success"),
	Err_UpdateRefereeFailor(-2,"更新裁判信息失败","error"),
	Err_AccessTokenNotExist(-3,"用户登录信息不存在，请重新登录","warn"), 
	Err_UserNotExist(-4,"用户不存在","error"),
	Err_AddStadiumResultFailor(-8,"新增赛场成绩信息失败","error"),
	Err_PwdError(-5,"密码错误","warn"),
	Err_DeleteRefereeFailor(-6,"删除裁判信息失败","error"),
	Err_AddFaultSupporFailor(-7,"添加故障支援信息失败","error"),
	Err_RefereeNoExist(-8,"裁判编号已存在","error"),
	Err_RefereeNoNull(-9,"裁判编号不能为空","warn"),
	Err_TeamAlreadyStart(-10,"比赛已开始","error"),
	Err_TeamNameExist(-11,"车队名称已存在","warn"),
	Err_NotOnlyOneDeviceFound(-12,"设备不唯一","warn"),
	Err_NoPower(-13,"权限不足","error"),
	Err_AddRefereeFailor(-14,"添加裁判失败","error"),
	Err_DeviceNameAreadyExist(-15,"设备编号已存在","error"),
	Err_DeviceAlreadyBound(-16,"设备已经被绑定","warn"),
	Err_AddScenesFailor(-17,"添加场景信息失败","warn"),
	Err_UpdateScenesFailor(-18,"更新场景信息失败","warn"),
	Err_DeleteScenesFailor(-19,"删除场景信息失败","error"),
	Err_AddIllegalFailor(-20,"添加违规行为失败","error"),
	Err_UpdateIllegalFailor(-21,"更新违规行为失败","error"),
	Err_DeleteIllegalFailor(-22,"删除违规行为失败","error"),
	Err_AddEquipmentFailor(-63,"添加设备失败","error"),
	Err_UpdateEquipmentFailor(-62,"更新设备失败","error"),
	Err_DeleteEquipmentFailor(-61,"删除设备失败","error"),
	Err_RegisterFailor(-23,"用户添加失败","error"),
	Err_UpdateUserFailor(-24,"修改用户失败","error"),
	Err_AddStadiumFailor(-25,"增加赛道信息失败","error"),
	Err_UpdateStadiumFailor(-26,"更新赛道信息失败","error"),
	Err_UploadTypeError(-27,"上传文件类型错误","error"),
	Err_SetAlarmPhoneFailor(-28,"设置报警手机号失败","error"),
	Err_DeviceListIsNull(-29,"设备列表为空","warn"),
	Err_DeviceManageListIsNull(-30,"未查询到设备管理信息","error"),
	Err_LoginRefereeNoIsNull(-31,"登录裁判编号不能为空","warn"),
	Err_DeleteUserFailor(-32,"删除用户失败","error"),
	Err_findUsersFailor(-33,"获取用户失败","warn"),
	Err_DeviceNoAlready(-34,"设备编号已经存在","warn"),
	Err_DeviceChangeFailor(-35,"修改设备信息失败","error"),
	Err_DeviceDeleteFailor(-36,"删除设备信息失败","error"),
	Err_UserEditFailor(-37,"用户没有编辑权限","error"),
	Err_NoTokenFind(-38,"在Header中未找到Token","error"),
	Err_LongTimeNoLogin(-39,"长时间未登录，请重新登录","warn"),
	Err_UpdateTeamFailor(-40,"更新车队失败","error"),
	Err_UpdateIsReadFailor(-41,"更改已读未读状态失败","error"),
	Err_OldPassIsWrong(-42,"旧密码错误","error"),
	Err_ChangePwdFailor(-43,"修改密码失败","error"),
	Err_DeleteTeamFailor(-44,"删除设备失败","error"),
	Err_SaveLocationFailor(-45,"上传定位信息失败","error"),
	Err_DeviceAlreadyAdd(-46,"设备已经被添加过了","warn"),
	Err_DeviceAlreadyAddOtherCompany(-46,"设备已经被其他公司添加过了","warn"),
	Err_AddDeviceInspectionFailor(-46,"添加年检信息失败","error"),
	Err_AddTeamFailor(-47,"添加车队信息失败","error"),
	Err_EndManualInterventionFailor(-48,"结束人工干预失败","error"),
	Err_StartManualInterventionFailor(-49,"开始人工干预失败","error"),
	Err_AddDriverFailor(-50,"添加司机信息失败","error"),
	Err_EndMatchFailor(-51,"结束比赛失败","error"),
	Err_PostScenesResultFailor(-52,"提交场景成绩失败","error"),
	Err_AddDeviceFailor(-53,"添加设备信息失败","error"),
	Err_DeleteDeviceFailor(-54,"删除设备信息失败","error"),
	Err_DeleteManualInterventionFailor(-55,"删除人工干预失败","error"),
	Err_ScenesStadiunBindAlready(-56,"场景已与赛道绑定,不可删除","error"),
	Err_UpdateOKStadiumResultFailor(-57,"修改比赛成绩失败","error"),
	Err_DeviceAlreadyBind(-46,"设备已经与车队绑定","warn"),
	Err_DeviceClose(-58,"设备未开启,不能绑定","warn"),
	Err_NoScenes(-59,"未获得场景信息","warn"),
	Err_AddScenesNameExist(-60,"场景名称已存在","warn")
	;
	
	private int code;
	
	private String description;
	
	private String type;
	
	ReturnCode(int code,String description,String type) {
		this.code=code;
		this.description=description;
		this.type=type;
	}
	
	public int getCode(){
		return this.code;
	}
	
	public String getDescription(){
		return this.description;
	}
	
	public String getType(){
		return this.type;
	}
	
	public static ReturnCode stateOf(int index) {
		
		for (ReturnCode state:values()) {
			if (state.getCode()==index) {
				return state;
			}
		}
		return null;
	}
}
